#include "get_lcs.h"
#include "get_edit_sequence.h"
#include <iostream> 
#include <fstream>  
#include <cassert> 
#include <string> 
#include <cstdlib> 
#include <cstdio> 
#include <vector>

using namespace std;

vector<string> read_file(string file_name) {
	ifstream in(file_name);
	string next_string;
	vector<string> result;
	while (getline(in, next_string)) {
		result.push_back(next_string);
	}
	
	return result;
}

int main() {
	const auto first_string_sequence = read_file("file1.in");
	const auto second_string_sequence = read_file("file2.in");

	vector<edit_operation> edit_sequence = get_edit_sequence(first_string_sequence, second_string_sequence, 
		                                      get_lcs_string(first_string_sequence, second_string_sequence));

	ofstream out("output.out");

	for (int i = 0; i < (int)edit_sequence.size(); ++i) {
		out << edit_sequence[i].action << " " << edit_sequence[i].str << '\n';
	}
	return 0;
}
